from django.db import models
from utils.my_models import CoreMyModel

class ResourceNews(CoreMyModel):
    title = models.CharField(max_length=255, verbose_name="标题", help_text="标题")
    news_img = models.CharField(max_length=1024, verbose_name="新闻封面", null=True, blank=True, help_text="新闻封面")
    resume = models.CharField(max_length=1024, verbose_name="摘要", null=True, blank=True, help_text="摘要")
    content = models.CharField(max_length=65535, verbose_name="内容", null=True, blank=True, help_text="内容")
    STATUS_CHOICES = (
        (0, "待上架"),
        (1, "已上架"),
        (2, "已下架"),
    )
    is_status = models.IntegerField(choices=STATUS_CHOICES, default=0, verbose_name="上架状态", null=True, blank=True,
                                 help_text="上架状态")
    TOP_CHOICES = (
        (0, "否"),
        (1, "是"),
    )
    is_top = models.IntegerField(choices=TOP_CHOICES, default=0, verbose_name="是否置顶", null=True, blank=True,
                                    help_text="是否置顶")

    TYPE_CHOICES = (
        (1, "公司新闻"),
        (2, "产品新闻"),
        (3, "产品更新"),
    )
    type = models.IntegerField(choices=TYPE_CHOICES, default=0, verbose_name="类型", null=True, blank=True,
                                 help_text="类型")
    sort = models.IntegerField(default=0, null=True, blank=True, verbose_name="显示排序", help_text="显示排序")

    class Meta:
        db_table = 'tbl_resource_news'
        verbose_name = '新闻资讯'
        verbose_name_plural = verbose_name
        ordering = ('-create_time',)
    